package com.hxx.day1.controller;

import java.util.Scanner;

public class DemoAction {
    public static void main(String[] args) {
        StudentController stu = new StudentController();
        Scanner scanner = new Scanner(System.in);
        boolean flag = true;
        int key = 0;
        do{
            System.out.println("1表示添加;2表示删除;3表示更新;4表示查找;5显示");
            key = scanner.nextInt();
            switch (key){
               case 1:
                   System.out.println("请输入一个数字");
                   stu.save(scanner.nextInt());
                   break;
               case 2:
                   System.out.println("请输入一个需要删除的数字");
                   stu.delete(scanner.nextInt());
                   break;
               case 3:
                   System.out.println("请输入一个需要更新的数字");
                   int i = scanner.nextInt();
                   System.out.println("请输入一个新的数字");
                   int n = scanner.nextInt();
                   stu.update(i,n);
                   break;
               case 4:
                   System.out.println("请输入一个查找的数字");
                   stu.find(scanner.nextInt());
                   break;
               case 5:
                  stu.findAll();
                  break;
               default:
                   flag = false;
                   break;
           }
        }while (flag);
    }
}
